<?xml version="1.0" encoding="ISO-8859-1" ?>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  
    xmlns:h="http://java.sun.com/jsf/html"  
    xmlns:f="http://java.sun.com/jsf/core"  
    xmlns:p="http://primefaces.org/ui"
    xmlns:ui="http://java.sun.com/jsf/facelets">  
  
    <h:head> 
    	<f:facet name="first">
            <meta http-equiv="X-UA-Compatible" content="EmulateIE8" />
            <meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
            <title>Locadora - Graph</title>
        </f:facet>
 
        <link type="text/css" rel="stylesheet" href="#{request.contextPath}/css/FilmeList.css" /> 
    	
    </h:head>  
      
    <h:body>
  	 	
    <p:layout style="min-width:400px;min-height:600px;" id="layout" fullPage="true">  
    	<p:layoutUnit position="north" size="100"  resizable="true" closable="true" collapsible="true" style="overflow:hidden;min-width:400px;min-height:160px;" >  
        	
    <h:form> 
        	<ui:include src="layout/toolbarAdmin.xhtml" />
        	
  			<center><h:graphicImage  height="100%" value="#{resource['img:logograph_banner.png']}" /></center>
  </h:form>
    	</p:layoutUnit>  
    	
    <p:layoutUnit position="center" style="overflow:hidden;" >   
      
   		<h:form id="form">
   		
   			<p:dataTable id="diretor" var="diretor" value="#{directorBeanTable.diretores}" scrollable="true" scrollHeight="410">
					<f:facet name="header">  
            LISTA DE DIRETORES CADASTRADOS  
        </f:facet> 
                    <p:column headerText="Nome" style="width:24%">
                        <h:outputText  value="#{diretor.name}" />
                    </p:column>

                    <p:column headerText="Sexo" style="width:24%">
                        <h:outputText value="#{diretor.gender}" />
                    </p:column>


                    <p:column style="width:4%">
                        <p:commandButton    id="selectButton" update=":formDialog:display" 
                            oncomplete="directorDialog.show()" icon="ui-icon-pencil" title="View">
                            <f:setPropertyActionListener value="#{diretor}"
                                target="#{directorBeanTable.selectedDirector}" />
                             <f:setPropertyActionListener value="#{diretor.name}"
                                target="#{directorBeanTable.nameKey}" />
                        </p:commandButton>
                    </p:column>

                </p:dataTable>
   		</h:form>
   		<h:form id="formDialog" >
   			 <p:dialog  header="Editar Diretor" widgetVar="directorDialog" resizable="false" id="directorDlg"  
                showEffect="fade" hideEffect="explode" modal="false" appendToBody="false" update="diretorDialog">  

					
                    <h:panelGrid id="display" columns="2" cellpadding="4"
                        style="margin:0 auto;">
                        <p:outputLabel>Nome:</p:outputLabel>
                        <p:inputText value="#{directorBeanTable.selectedDirector.name}" style="font-weight:bold"></p:inputText>
						<p:outputLabel>Sexo:</p:outputLabel>
	         			<p:selectOneMenu id="indicadorEditDiretor" value="#{directorBeanTable.selectedDirector.gender}">
						  <f:selectItem itemValue="Masculino" itemLabel="Masculino" />
						  <f:selectItem itemValue="Feminino" itemLabel="Feminino" />
						  
						</p:selectOneMenu>
						 
						<p:commandButton  actionListener="#{directorBeanTable.updateDirector}" value="Atualizar"  ajax="false" icon="ui-icon ui-icon-arrowrefresh-1-n">
						</p:commandButton>
                    </h:panelGrid>
                   

                </p:dialog>
   		</h:form>
   		</p:layoutUnit>
   		</p:layout>
    </h:body>  
</html>  